Repository navigation
Apply known state corrections proven by stored block rewards (7hWM6wvs, one contract-state fee) - #184
Merged
Merged
Conversation
The lineage of the published pruned snapshots synced the dice-contract blocks of October 2026 with the official replay rule, so it holds one contract-state fee (0.008740234375 CS) less for 7hWM6wvs... than the majority that executed the contract. Being a confidant in half of the rounds, every reward split a community node signs for it differs from the majority's by that fee and the node ends up in the stage-3 minority (stage3 "failed=block+round, trusted hash agreed"). Recomputing SolverCore::setBlockReward from the node's wallet data reproduces the stored reward split bit for bit for every recent block without that wallet, and for every block with it only once the fee is added to its balance (40,000 blocks around 187,722,000; no other value does). The other always-failing confidants fail exactly in the rounds where 7hWM6wvs... is a co-confidant, so they carry the same state. csnode/statecorrection keeps a table of such known differences. A correction is applied once, at the first block that proves it: the wallet is a trusted confidant, the stored split (signed by the majority) differs from the one this node's stakes give, and is reproduced exactly with the delta applied. A node whose state is right never applies it, an applied correction is never applied twice, and a block neither value explains is only logged. getStakingCoefficient becomes static so the stake can be computed outside the solver with the same operations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…upport The origin of the 7hWM6wvs... difference is the dice payout 176760929.2 (block 176,760,929, 2026-06-05): a failed replay with a stale ref_execute charged its contract-state fee to 7hWM6wvs..., the previous caller. - KnownStateCorrection gets the chain uuid it applies to (mainnet only, so never on the test network or private networks; BlockChain::uuid() is also known to nodes started from a snapshot), a fromSequence (176,760,929) and a list of counterpart adjustments applied in the same step. If a counterpart balance is below its adjustment nothing is applied and a warning is logged. - The mainnet entry has no counterpart. MooNRor8... was the expected one, but 8 majority and 3 minority nodes report the same MooNRor8... balance at block 187,731,527 while 7hWM6wvs... is exactly one fee apart, so an adjustment there would create a difference. - blockRewardSplit takes stakingOn as SolverCore::setBlockReward does; with staking off the split does not depend on the stakes and proves nothing. - The decision is extracted into decideKnownStateCorrection with the wallet state read through a lookup, and tested on the stored mainnet blocks: fires once and applies both adjustments (test table with a counterpart), not on a correct state, not again on the next proving block, not below fromSequence, not on other networks, the counterpart guard. - The rate-limited warning counter is per entry (WalletsCache member). - docs/differences.md: origin, the MooNRor8... check, and that rounds whose trusted majority is the uncorrected group may still put a corrected node in the minority. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Community nodes are the stage-3 minority on mainnet (
failed=block+round, trusted hash agreed) in every round where7hWM6wvsojdPy3A2pQjqWKtfJM4hQRCWe3YC2hB2WzbEis a confidant, which is half of the rounds.Recomputing
SolverCore::setBlockRewardexactly (samecsdb::Amountoperations) from our node's wallet data via the API:The component that differs is the balance (the 500,000 CS time delegation, coeff Anni, and the staking rules are the same). Origin (traced): dice payout 176760929.2 in block 176,760,929 (2026-06-05) pays
MooNRor8…the win of its call 176760925.1. The lineage of the published pruned snapshots replayed that contract state with the official rule (before #94); the replay failed, the staleref_executestill pointed to the previous successful call, by 7hWM6wvs, and the payout's contract-state fee was charged to 7hWM6wvs. The majority that executed the contract did not. This is the same divergence that stopped our node at 176,776,317 (the transfer exceeded our balance by exactly one fee). Mainnet nodes themselves disagree (7 vs 13 in October), and the other always-gray-listed confidants (M9kkJAc7, Gc4X25fU, 74xsody1, EVnmYugp, CGHoC52e, 6ZW39KmR) are excluded in 100 % (94 % for 6ZW39KmR) of the rounds where 7hWM6wvs is a co-confidant and in none of the others: they hold the same state (synced from scratch with the official rule). GteSXezK is excluded in every round regardless.What
csnode/statecorrection: a table of known state differences (one entry: 7hWM6wvs, +0.008740234375 CS, mainnet uuid only, from block 176,760,929; entries can carry counterpart adjustments applied in the same step).WalletsCache::Updater::loadNextBlockchecks a correction only at a block where the wallet is a trusted confidant: it recomputes the reward split from this node's stakes and applies the delta only if the stored split (signed by the majority) differs from the one this node's stakes give and is reproduced exactly with the delta. So:BlockChain::uuid()== mainnet, also known to nodes started from a snapshot; so never on the test network or private networks) and only from itsfromSequence;blockRewardSplittakesstakingOnassetBlockRewarddoes (oneMiningPart = 0 when off); with staking off the split does not depend on the stakes, so the decision proves nothing. Below StartingDPOS the stored split sums to 0 and nothing is checked.The decision is in
decideKnownStateCorrection(wallet state through an injectable lookup);applyKnownStateCorrectionsreads the wallets, calls it and applies the entry.BlockChain::getStakingCoefficientbecomes static so the stake can be computed outside the solver with the same operations; the solver is untouched.Classification: option (b), a one-time state correction, verified by the chain rather than tied to a block number. It changes no consensus rule and no official behaviour; it moves a wrong node to the value the majority signs. Option (a) does not apply (no fork code path produces the difference today; #94 charges the fee as the majority does). Option (c), a corrected snapshot, follows from this fix: the next snapshot built from a corrected node carries the right value, and nodes that restore older snapshots correct themselves at their first 7hWM6wvs block.
No counterpart.
MooNRor8…(the payout's real payer) was expected to be one fee too high in our state, and a paired −0.008740234375 was planned. A read-only check of the public API (WalletDataGet, same block 187,731,527, 2026-11-10) contradicts it: 8 majority nodes and 3 minority nodes all reportMooNRor8…= 900.821476562547572367, while7hWM6wvs…is exactly one fee higher on the majority (53538.950025036183020160 vs 53538.941284801808020160). The emitted fee is already part ofMooNRor8…'s call fee on every lineage, so adjusting it would create a difference. The counterpart mechanism stays (tested with a test-only entry) but the mainnet entry has none.Side observation from the same check:
AL3dpJg3…differs among majority nodes themselves (+1 fee on 2 of them, +5 fees on 6, vs. the minority), so the majority's states are not uniform for non-confidant dice players either. Not addressed here.Rounds where the trusted majority is the uncorrected group may still put a corrected node in the minority.
Tests
nodetests:StateCorrectiontests on two real mainnet blocks (187722654 without the wallet, 187722656 with it) with the confidants' wallet state as our node holds it, plusStateCorrectionTriggertests of the decision with injected state: fires once and applies both adjustments (test entry with a counterpart), not on a correct state, not again on the next proving block, not belowfromSequence, not on testnet/private/unknown uuid, not with staking off, the counterpart-balance guard (one unit below the fee, zero, exactly the fee), an unexplained difference, and the mainnet table changing only 7hWM6wvs. A fullWalletsCachetest was too heavy (needs aBlockChainand its databases), so the extracted decision is tested instead. Full ctest passes.credits-pruned-c3, read-only, copied), this build, Docker internal network (no route out): quick start from qs/187700000, the correction fired once at block 187,700,001 (balance of 7hWM6wvs… += 0.008740234375), no "does not explain" warning, replay to 187,722,885 with no error; afterwards the recomputation against this node's API matches 300/300 stored blocks with no adjustment.🤖 Generated with Claude Code